<template>
  <div id="app">
    <router-view v-if="showView" />
  </div>
</template>

<script>
import {getAppTitle} from "@/utils/auth";

export default  {
  name:  'App',
  data() {
    return {
      // 用于点击当前页的router时，刷新当前页
      showView: true,
    }
  },

  created() {
    // fix: firefox 下 拖拽 会新打卡一个选项卡
    // https://github.com/JakHuang/form-generator/issues/15
    document.body.ondrop = function (event) {
      event.preventDefault();
      event.stopPropagation();
    }
  },
  methods: {
    // 刷新当前路由方法
    refreshView() {
      this.showView = false
      this.$nextTick(() => (this.showView = true))
    },
  },
    metaInfo() {
        return {
            title: this.$store.state.settings.dynamicTitle && this.$store.state.settings.title,
            titleTemplate: title => {
                return title ? `${title} - `+getAppTitle() : getAppTitle()
            }
        }
    }
}
</script>
